package com.lm.activiti.boot.tools.excel;

import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON;
import org.junit.Test;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * @author lm_jcf
 * @date 2022/3/21 16:15
 */
public class ExcelReaderCase {


    @Test
    public void read() {
        String excelPath = "D:\\南宁二中标准数据模型增量\\微班试卷答题卡\\所有班级单科成绩报告\\【2021-2022学年度高一年级期末考试】所有单科成绩报告 - 副本.xls";

        ExcelReader reader2 = ExcelUtil.getReader(new File("D:\\南宁二中标准数据模型增量\\微班试卷答题卡\\所有班级单科成绩报告\\【2021-2022学年度高一年级期末考试】所有单科成绩报告.xls"));

        System.out.println(JSON.toJSONString(reader2.getSheetNames()));

        for (String sheetName : reader2.getSheetNames()) {
            ExcelReader reader = ExcelUtil.getReader(new File(excelPath), sheetName);

            List<List<Object>> read = reader.read();

            System.out.println(read.get(0).get(0));
            System.out.println(read.get(0).get(1));

            System.out.println(read.size());

        }
    }
}
